import { getDetailAPI } from "@/apis/detail";
import { onMounted, ref } from "vue";
import { useRoute } from "vue-router";

export function useGoods() {
    const goods = ref({})

    const route = useRoute()
    const getGoods = async () => {
        const res = await getDetailAPI(route.params.id)
        goods.value = res.result
    }
    
    onMounted(() => {
        getGoods()
    })


    return {goods}
}

